﻿@model TesisProj.Areas.Plantilla.Models.PlantillaFormula

@{
    ViewBag.Title = "Fórmulas: " + @ViewBag.Plantilla;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Editar @Model.Nombre (@ViewBag.Plantilla)</h2>

<p>
    <br />
    <a class="btn btn-inverse" style="color: #E6F0F2"href="@Url.Action("Index", new { id = Model.IdPlantillaElemento })">
  	    <i class="icon-arrow-left icon-white"></i>Regresar
    </a><br /><br />
</p>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Fórmula</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Nombre)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Nombre)
            @Html.ValidationMessageFor(model => model.Nombre)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Referencia)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Referencia)
            @Html.ValidationMessageFor(model => model.Referencia)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Secuencia)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Secuencia)
            @Html.ValidationMessageFor(model => model.Secuencia)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdPlantillaElemento)
        </div>

    <div class="row-fluid">
        <div class="span5">

            <div class="editor-field">
                @Html.DropDownList("IdPlantillaElemento")
                @Html.ValidationMessageFor(model => model.IdPlantillaElemento)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.IdTipoFormula)
            </div>
            <div class="editor-field">
                @Html.DropDownList("IdTipoFormula", String.Empty)
                @Html.ValidationMessageFor(model => model.IdTipoFormula)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.Visible)
            </div>
            <div class="editor-field">
                @Html.CheckBoxFor(model => model.Visible)
                @Html.ValidationMessageFor(model => model.Visible)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.PeriodoInicial)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.PeriodoInicial)
                @Html.ValidationMessageFor(model => model.PeriodoInicial)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.PeriodoFinal)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.PeriodoFinal)
                @Html.ValidationMessageFor(model => model.PeriodoFinal)
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.Cadena)
            </div>
            <div class="editor-field">
                @Html.TextAreaFor(model => model.Cadena, new { @rows = 5, style="width: 350px" })
            </div>
            <div>
                @Html.ValidationMessageFor(model => model.Cadena)
            </div>
        </div>
    <div class="span7">
            <div class="editor-label">
                @Html.Label("Parámetros disponibles")
            </div>
            <div>
                @Html.ListBox("ListParametros", ViewBag.ListParametros as SelectList, new { @Size = 5, @class="Chooser" })
            </div>

            <div class="editor-label">
                @Html.Label("Fórmulas disponibles")
            </div>
            <div>
                @Html.ListBox("ListFormulas", ViewBag.ListFormulas as SelectList, new { @Size = 5, @class="Chooser" })
            </div>

            <div class="editor-label">
                @Html.Label("Variables globales")
            </div>
            <div>
                @Html.ListBox("GlobalList", ViewBag.GlobalList as SelectList, new { @Size = 5, @class="Chooser" })
            </div>

            <div class="editor-label">
                @Html.Label("Funciones disponibles")
            </div>
            <div>
                @Html.ListBox("FuncionesList", ViewBag.FuncionesList as SelectList, new { @Size = 5, @class="Chooser" })
            </div>
        </div>
    </div>

        @Html.HiddenFor(model => model.Id)

        <p>
            <input type="submit" value="Guardar" />
        </p>
    </fieldset>
}

<p>
    <a class="btn btn-inverse" style="color: #E6F0F2"href="@Url.Action("Index", new { id = Model.IdPlantillaElemento })">
  	    <i class="icon-arrow-left icon-white"></i>Regresar
        </a>
</p>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

<script>
    $(".Chooser").click(function() {
        var referencia = $(this).val();
        $("#Cadena").val($("#Cadena").val() + " " + referencia);
        $("#Cadena").focus();
    })
</script>